The read-write register is a metric that "holds" the value that is written to it (through a command) from Sparkplug, and the same value is then provided when the metric is published to Sparkplug. Without further configuration, each metric in Rapid Toolkit for Sparkplug behaves essentially as a read-write register, because
However, even though the default behavior correspond to the read-write register, you usually still need to configure additional properties on the metric, such as the data type. In most cases, you also want to define some reasonable initial data for the metric. These tasks can be done with the help of extensions methods for Sparkplug Metric Configuration.
Rapid Toolkit for Sparkplug provides extension methods that allow you to define read-write register metrics easily. This is described in the Sparkplug Metric Configuration article. Typically, you will use some overload of the ReadWrite or ReadWriteValue method to configure the metric as the read-write register. The following example illustrates the use of the ReadWriteValue method.
How do you choose between these extension methods?
The following example illustrates the use of the ReadWrite method for defining a read-write register with specified initial data (including timestamp).
The read-write registers defined by the ReadWrite method allow writing of the value and timestamp. The read-write registers defined by the ReadWriteValue method only allow writing of the value.
See Sparkplug Metric Data Type Considerations.
Sparkplug is a trademark of Eclipse Foundation, Inc. "MQTT" is a trademark of the OASIS Open standards consortium. Other related terms are trademarks of their respective owners. Any use of these terms on this site is for descriptive purposes only and does not imply any sponsorship, endorsement or affiliation.